{include file="public/toper" /}
<style>
    .layui-table th {width: 20%}
    .layui-table td {width: 20%;color: #FF0000;}
</style>
<script src="/static/js/echarts.common.min.js"></script>
<script src="/static/js/westeros.js"></script>
<div class="x-body layui-anim layui-anim-up">
    <blockquote class="layui-elem-quote">欢迎管理员：
        <span class="x-red">{$Think.session.admin_user.store_name}</span>   <span id="nowTime"></span></blockquote>
    <fieldset class="layui-elem-field">
        <legend>【{$Think.session.admin_user.name}】数据统计</legend>
        <div class="layui-field-box">
            <table class="layui-table" style="width: 40%;margin: 10px 5% !important;float: left;"> <p>今日【<?PHP echo date('Y-m-d') ?>】订单统计信息</p>
                <tbody>
                <tr>
                    <th>在线销售订单数</th>
                    <td>{$list.order_count1}</td>
                    <th>在线销售订单金额</th>
                    <td>{$list.pay_price1}</td>
                </tr>
                <tr>
                    <th>在线共享订单数</th>
                    <td>{$list.order_count2}</td>
                    <th>在线共享订单金额</th>
                    <td>{$list.pay_price2}</td>
                </tr>
                <tr>
                    <th>在线会员卡销售数</th>
                    <td>{$list.order_count3}</td>
                    <th>在线会员卡销售金额</th>
                    <td>{$list.pay_price3}</td>
                </tr>
                </tbody>
            </table>
            <table class="layui-table" style="width: 40%;margin: 10px 5% !important;float: left;"> <p>昨日【<?PHP echo date('Y-m-d',strtotime('-1 day')) ?>】订单统计信息</p>
                <tbody>
                <tr>
                    <th>在线销售订单数</th>
                    <td>{$list2.order_count1}</td>
                    <th>在线销售订单金额</th>
                    <td>{$list2.pay_price1}</td>
                </tr>
                <tr>
                    <th>在线共享订单数</th>
                    <td>{$list2.order_count2}</td>
                    <th>在线共享订单金额</th>
                    <td>{$list2.pay_price2}</td>
                </tr>
                <tr>
                    <th>在线会员卡销售数</th>
                    <td>{$list2.order_count3}</td>
                    <th>在线会员卡销售金额</th>
                    <td>{$list2.pay_price3}</td>
                </tr>
                </tbody>
            </table>
            <table class="layui-table" style="width: 40%;margin: 10px 5% !important;float: left;"> <p>到今天为止本月【<?PHP echo date('Y-m') ?>】统计信息</p>
                <tbody>
                <tr>
                    <th>在线销售订单数</th>
                    <td>{$list3.order_count1}</td>
                    <th>在线销售订单金额</th>
                    <td>{$list3.pay_price1}</td>
                </tr>
                <tr>
                    <th>在线共享订单数</th>
                    <td>{$list3.order_count2}</td>
                    <th>在线共享订单金额</th>
                    <td>{$list3.pay_price2}</td>
                </tr>
                <tr>
                    <th>在线会员卡销售数</th>
                    <td>{$list3.order_count3}</td>
                    <th>在线会员卡销售金额</th>
                    <td>{$list3.pay_price3}</td>
                </tr>
                </tbody>
            </table>
            <table class="layui-table" style="width: 40%;margin: 10px 5% !important;float: left;"> <p>到今天为止本年【<?PHP echo date('Y') ?>】统计信息</p>
                <tbody>
                <tr>
                    <th>在线销售订单数</th>
                    <td>{$list4.order_count1}</td>
                    <th>在线销售订单金额</th>
                    <td>{$list4.pay_price1}</td>
                </tr>
                <tr>
                    <th>在线共享订单数</th>
                    <td>{$list4.order_count2}</td>
                    <th>在线共享订单金额</th>
                    <td>{$list4.pay_price2}</td>
                </tr>
                <tr>
                    <th>在线会员卡销售数</th>
                    <td>{$list4.order_count3}</td>
                    <th>在线会员卡销售金额</th>
                    <td>{$list4.pay_price3}</td>
                </tr>
                </tbody>
            </table>
            <div style="clear:both;height:0;overflow:hidden;"></div>
            <table class="layui-table" style="width: 40%;margin: 10px 5% !important;float: left;"> <p>商品信息</p>
                <tbody>
                <tr>
                    <th>在线商品总数</th>
                    <td>{$goods.num}</td>
                    <th>可共享商品总数</th>
                    <td>{$goods.type_num}</td>
                </tr>
                <tr>
                    <th>缺货商品总数</th>
                    <td>{$goods.shortage_num}</td>
                    <th>已下架商品总数</th>
                    <td>{$goods.shelves_num}</td>
                </tr>
                </tbody>
            </table>
            <div style="clear:both;height:0;overflow:hidden;"></div>
            <table class="layui-table" style="width: 40%;margin: 10px 5% !important;float: left;"> <p>订单信息</p>
                <tbody>
                <tr>
                    <th>销售待发货订单总数</th>
                    <td>{$order.order_status}</td>
                    <th>共享待发货订单总数</th>
                    <td>{$order.order_status2}</td>
                </tr>
                <tr>
                    <th>归还待收货订单总数</th>
                    <td>{$order.order_status3}</td>
                    <th>未归还商品总数</th>
                    <td>{$order.order_status4}</td>
                </tr>
                </tbody>
            </table>
            <div style="clear:both;height:0;overflow:hidden;"></div>
            <div id="main" style="height:400px;width: 100%"></div>
        </div>
    </fieldset>
</div>
<script>
    //初始化图表标签
    var main = echarts.init(document.getElementById('main'), 'westeros');

    //main.showLoading();
    main.setOption({
        title : {text: '门店月度营业额',},
        tooltip: {trigger: 'axis'},
        legend: {data:['销售收入','共享收入','会员卡收入'],},
        grid: {left: '3%',right: '4%',bottom: '3%',containLabel: true},
        toolbox: {show: true,
            feature: {
                dataZoom: {yAxisIndex: 'none'},
                dataView:  false,
                magicType: {type: ['line', 'bar']},
                restore: {},
                saveAsImage: {}
            }
        },
        xAxis: {
            type: 'category',
            boundaryGap: false,
            //data: ['1','2','3']
        },
        yAxis: {type: 'value'},
        series: [
            {

                type:'line',
                itemStyle: {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'gray',
                                fontSize: 12
                            }
                        }
                    }
                },

            },
            {

                type:'line',
                itemStyle: {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'gray',
                                fontSize: 12
                            }
                        }
                    }
                },

            },
            {

                type:'line',
                itemStyle: {
                    normal: {
                        label: {
                            show: true, //开启显示
                            position: 'top', //在上方显示
                            textStyle: { //数值样式
                                color: 'gray',
                                fontSize: 12
                            }
                        }
                    }
                },

            },


        ],
        dataset: {
            source: [
              ['']
            ]
        },
    })

    $.get("{:url('Index/echarts')}").done(function (data) {
        // 填入数据
        main.hideLoading();
        data = $.parseJSON(data);
        main.setOption({
            dataset: {
                source: data.data
            },

        });
    });


        //获取系统时间
        var newDate = '';
        getLangDate();
        //值小于10时，在前面补0
        function dateFilter(date){
            if(date < 10){return "0"+date;}
            return date;
        }
        function getLangDate(){
            var dateObj = new Date(); //表示当前系统时间的Date对象
            var year = dateObj.getFullYear(); //当前系统时间的完整年份值
            var month = dateObj.getMonth()+1; //当前系统时间的月份值
            var date = dateObj.getDate(); //当前系统时间的月份中的日
            var day = dateObj.getDay(); //当前系统时间中的星期值
            var weeks = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
            var week = weeks[day]; //根据星期值，从数组中获取对应的星期字符串
            var hour = dateObj.getHours(); //当前系统时间的小时值
            var minute = dateObj.getMinutes(); //当前系统时间的分钟值
            var second = dateObj.getSeconds(); //当前系统时间的秒钟值
            var timeValue = "" +((hour >= 12) ? (hour >= 18) ? "晚上" : "下午" : "上午" ); //当前时间属于上午、晚上还是下午
            newDate = dateFilter(year)+"年"+dateFilter(month)+"月"+dateFilter(date)+"日 "+" "+dateFilter(hour)+":"+dateFilter(minute)+":"+dateFilter(second);
            document.getElementById("nowTime").innerHTML = timeValue+"好！当前时间为： "+newDate+"　"+week;
            setTimeout("getLangDate()",1000);
        }
</script>